<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<!--<link href="../js/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">-->
		<link rel="stylesheet" type="text/css" href="../../../js/bootstrap-3.3.7-dist/css/bootstrap.min.css"/>
		<!--<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />-->
		<link rel="stylesheet" type="text/css" href="../../../css/footer.css" />
		<link rel="stylesheet" type="text/css" href="../../../css/gift_sell.css"/>
		<script src="../../../js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="../../../css/store_member/style.css"/>
		<style type="text/css">
			.gift_sell_wap ul li{
				height: 4.3rem;
				
			}
			body{
				overflow: auto;
			}
			button.f28_s:focus{
				outline: none;
			}
		</style>
	</head>

	<body>
		<div id="wrap">
			<div id="main">
				<div id="header">
					<a id="headImg" href="javascript:history.go(-1)"><img class="headImg" src="../../../images/12.png" /></a>
					<p id="headTitle">售卖礼品</p>
				</div>
				<div class="nav" style="overflow: hidden;margin-top:1.3rem;">
			<span id="type111" class="f28_s active_red col-xs-4" style="text-align: center;" onclick="all_product()">全部</span>
			<span id="type222" class="f28_s col-xs-4" style="text-align: center;" onclick="wei()">寄卖中</span>
			<span id="type333" class="f28_s col-xs-4" style="text-align: center;" onclick="yi()">完成寄卖</span>
		</div>
				<div id="content">
					<div class="gift_sell_wap">
						<ul id="gift_main">
							<li style="height: 2.77777rem;">
								<div class="gift_left">
									<img src="../../../images/coalltion/mianbao.jpg"/>
								</div>
								<div class="gift_right">
									<p>巴拉巴拉</p>
									<p>积分:</p>
									<p class="active_red" style="position: absolute;bottom: 10px;">领取时间：1111111</p>
								</div>
								<div class="duihuan">
									<img src="../../../images/store/duihuan.png"/>
								</div>
							</li>
							<li style="overflow: hidden;">
								<div style="overflow: hidden;">
								<div class="gift_left">
									<img src="../../../images/coalltion/mianbao.jpg"/>
								</div>
								<div class="gift_right">
									<p>巴拉巴拉</p>
									<p>积分:</p>
									<p class="active_red" style="position: absolute;bottom: 1.625rem;">领取时间：1111111</p>
								</div>
								<div class="duihuan">
									<img src="../../../images/store/duihuan.png"/>
								</div>
								</div><p style="clear: both;margin-top: 10px;text-align: center;"><button class="f28_s" style="padding: 10px 15px;border-radius: 20px;border: 0;background-color: red;color: white;margin-right: 10px;" >发货</button><button class="f28_s" style="padding: 10px 15px;border-radius: 20px;border: 1px solid red;background-color: white;color: red;">转卖</button></p>
							</li>
						</ul>
					</div>
					<!--<a href="../foods_detail.html">发货</a>-->
				</div>
			</div>
		</div>
		
	</body>
	<script src="../../../js/jquery-2.2.3.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/bootstrap-3.3.7-dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		$.ajax({
			type:"get",
			url:"http://47.104.13.109/cart-service/goldcartselectAll?pageNum=1&pageSize=10000",
			async:true,
			data:{
				userid:8,
			},
			success:function(data){
				console.log(data);
				var a = '';
				for (var i = 0;i<data.list.length;i++) {
//					var pic = data.list[i].goodsPic;
					var pic = '../../../images/coalltion/mianbao.jpg';
					if(data.list[i].goodsResell==0){
					a+='<li style="height: 2.77777rem;"><div class="gift_left"><img src="'+data.list[i].goodsPic+'"/></div><div class="gift_right"><p>商品名：'+data.list[i].goodsName+'</p><p>金币:'+data.list[i].goodsgold+'</p><p class="active_red" style="position: absolute;bottom: 10px;">领取时间'+data.list[i].reselltime+'</p></div><div class="duihuan"><img src="../../../images/store/yifahuo.png"/></div></li>'	
					}else{
					a+='<li style="overflow: hidden;"><div class="gift_left"><img src="'+data.list[i].goodsPic+'"/></div><div class="gift_right" ><p></p>商品名：'+data.list[i].goodsName+'<p>金币:'+data.list[i].goodsgold+'</p><p class="active_red"  style="position: absolute;bottom: 1.625rem;">领取时间'+data.list[i].reselltime+'</p></div><div class="duihuan"><img src="../../../images/store/duihuan.png"/></div><p style="clear: both;margin-top: 10px;text-align: center;"><button class="f28_s" style="padding: 10px 15px;border-radius: 20px;border: 0;background-color: red;color: white;margin-right: 10px;"onclick="fahuo('+data.list[i].orderId+')">发货</button><button class="f28_s" style="padding: 10px 15px;border-radius: 20px;border: 1px solid red;background-color: white;color: red;"onclick="zhuanmai('+data.list[i].orderId+')">转卖</button></p></li>'	
					}
					
				}
				$('#gift_main').html(a);
			}
		});
		function fahuo(data){
			$.ajax({
				type:"post",
				url:"http://47.104.13.109/order-service/update",
				async:true,
				data:{
					orderId:data,
				},success:function(res){
					console.log(res);
					alert("发货成功");
					window.location.reload();
				}
			});
		}
		function zhuanmai(data){
			$.ajax({
				type:"post",
				url:"http://47.104.13.109/order-service/updateresell",
				async:true,
				data:{
					orderId:data,
				},success:function(res){
					console.log(res);
					alert("转卖成功");
					window.location.reload();
				}
			});
		}
		function all_product(){
		$.ajax({
			type:"get",
			url:"http://47.104.13.109/cart-service/goldcartselectAll?pageNum=1&pageSize=10000",
			async:true,
			data:{
				userid:8,
			},
			success:function(data){
				console.log(data);
				var a = '';
				for (var i = 0;i<data.list.length;i++) {
//					var pic = data.list[i].goodsPic;
					var pic = '../../../images/coalltion/mianbao.jpg';
					if(data.list[i].goodsResell==0){
					a+='<li style="height: 2.77777rem;"><div class="gift_left"><img src="'+data.list[i].goodsPic+'"/></div><div class="gift_right"><p>商品名：'+data.list[i].goodsName+'</p><p>金币:'+data.list[i].goodsgold+'</p><p class="active_red" style="position: absolute;bottom: 10px;">领取时间'+data.list[i].reselltime+'</p></div><div class="duihuan"><img src="../../../images/store/yifahuo.png"/></div></li>'	
					}else{
					a+='<li style="overflow: hidden;"><div class="gift_left"><img src="'+data.list[i].goodsPic+'"/"></div><div class="gift_right" ><p></p>商品名：'+data.list[i].goodsName+'<p>金币:'+data.list[i].goodsgold+'</p><p class="active_red"  style="position: absolute;bottom: 1.625rem;">领取时间'+data.list[i].reselltime+'</p></div><div class="duihuan"><img src="../../../images/store/duihuan.png"/></div><p style="clear: both;margin-top: 10px;text-align: center;"><button class="f28_s" style="padding: 10px 15px;border-radius: 20px;border: 0;background-color: red;color: white;margin-right: 10px;"onclick="fahuo('+data.list[i].orderId+')">发货</button><button class="f28_s" style="padding: 10px 15px;border-radius: 20px;border: 1px solid red;background-color: white;color: red;"onclick="zhuanmai('+data.list[i].orderId+')">转卖</button></p></li>'	
					}
					
				}
				$('#gift_main').html(a);
			}
		});
		$('#type111').addClass('active_red');
		$('#type222').removeClass('active_red');
		$('#type333').removeClass('active_red');
		}
		function wei(){
			$.ajax({
			type:"get",
			url:"http://47.104.13.109/cart-service/selectresell?pageNum=1&pageSize=100",
			async:true,
			data:{
				userid:8,
			},
			success:function(data){
				console.log(data);
				var a = '';
				for (var i = 0;i<data.list.length;i++) {
					if(data.list[i].goodsResell==0){
					a+='<li style="overflow: hidden;"><div class="gift_left"><img src="'+data.list[i].goodsPic+'"/></div><div class="gift_right" ><p></p><p>金币:'+data.list[i].goosGold+'</p><p class="active_red"  style="position: absolute;bottom: 1.625rem;">领取时间'+data.list[i].orderCreatetime+'</p></div><div class="duihuan"><img src="../../../images/store/duihuan.png"/></div><p style="clear: both;margin-top: 10px;text-align: center;"><button class="f28_s" style="padding: 10px 15px;border-radius: 20px;border: 0;background-color: red;color: white;margin-right: 10px;"onclick="fahuo('+data.list[i].orderId+')">发货</button><button class="f28_s" style="padding: 10px 15px;border-radius: 20px;border: 1px solid red;background-color: white;color: red;"onclick="zhuanmai('+data.list[i].orderId+')">转卖</button></p></li>'	
					}
					
				}
				$('#gift_main').html(a);
			}
		});
		$('#type222').addClass('active_red');
		$('#type111').removeClass('active_red');
		$('#type333').removeClass('active_red');
		}
		function yi(){
			$.ajax({
			type:"get",
			url:"http://47.104.13.109/cart-service/selectover?pageNum=1&pageSize=100",
			async:true,
			data:{
				userid:8,
			},
			success:function(data){
				console.log(data);
				var a = '';
				for (var i = 0;i<data.list.length;i++) {
					if(data.list[i].goodsResell==1){
					a+='<li style="overflow: hidden;"><div class="gift_left"><img src="'+data.list[i].goodsPic+'"/></div><div class="gift_right" ><p></p>商品名：'+data.list[i].goodsName+'<p>金币:'+data.list[i].goodsgold+'</p><p class="active_red"  style="position: absolute;bottom: 1.625rem;">领取时间'+data.list[i].reselltime+'</p></div><div class="duihuan"><img src="../../../images/store/duihuan.png"/></div><p style="clear: both;margin-top: 10px;text-align: center;"><button class="f28_s" style="padding: 10px 15px;border-radius: 20px;border: 0;background-color: red;color: white;margin-right: 10px;"onclick="fahuo('+data.list[i].orderId+')">发货</button><button class="f28_s" style="padding: 10px 15px;border-radius: 20px;border: 1px solid red;background-color: white;color: red;"onclick="zhuanmai('+data.list[i].orderId+')">转卖</button></p></li>'	
					}
					
				}
				$('#gift_main').html(a);
			}
		});
		$('#type333').addClass('active_red');
		$('#type222').removeClass('active_red');
		$('#type111').removeClass('active_red');
		}
	</script>
</html>